<%--
  Created by IntelliJ IDEA.
  User: JY
  Date: 2022/1/7
  Time: 11:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>档案删除</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
</head>
<body>
<span style="color: blue;font-family:华文宋体"><marquee width=400 direction=left align=middle><span>您正在做的业务是：产品设计--产品档案管理--产品档案删除</span></marquee></span>
<div class="row" style="margin-top: 20px;padding-left: 100px" >
    <table id="table" class="table table-hover table-bordered" style="width: 1100px">
        <thead>
        <tr align="center">
            <th>产品编号</th>
            <th>产品名称</th>
            <th>用途类型</th>
            <th>I级分类</th>
            <th>II级分类</th>
            <th>III级分类</th>
            <th>产品经理</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
    </table>
</div>
</body>
<script src="/js/bootstrap-table-zh-CN.min.js"></script>
<script src="/js/jquery.form.js"></script>
<script src="/js/jquery.serializejson.js"></script>

<script>
    jiazai()
    function jiazai() {
        $("#table").bootstrapTable({
            method: "post",
            contentType: "application/json",
            url: "/dfile/DelDFile",
            striped: true,
            pageNumber: 1,
            pagination: true,
            sidePagination: "server",
            pageSize: 2,
            pageList: [2, 4, 6, 8],
            queryParams: function (param) {
                return {
                    page: (param.offset / param.limit) + 1,
                    num: param.limit,
                }
            },
            columns: [
                {title: "产品编号", field: "productId", align: "center"},
                {title: "产品名称", field: "productName", align: "center"},
                {
                    title: "用途类型", field: "type", align: "center",
                    formatter: function (value, row, index) {
                        var type;
                        if (row.type == "Y001-1") {
                            type = "商品";
                        } else if (row.type == "Y001-2") {
                            type = "物料";
                        }
                        return type;
                    }
                },
                {title: "I级分类", field: "firstKindName", align: "center"},
                {title: "II级分类", field: "secondKindName", align: "center"},
                {title: "III级分类", field: "thirdKindName", align: "center"},
                {title: "产品经理", field: "responsiblePerson", align: "center"},
                {
                    title: "操作", field: "id", align: "center",
                    formatter: function (value, row, index) {
                        console.log(row)
                        var btn1 = "<button class='btn btn-primary btn-sm' onclick=\"href(" + row.id + ")\">删除</button>";
                        return btn1
                    }
                }
            ]
        })
        $("#submit_select").click(function () {
            $("#table").bootstrapTable("refresh");
        })
    }
</script>
<script>
    function href(id) {
        console.log(id)
      $.get("http://localhost:8080/dfile/upId?id="+id,function (data) {
          window.location="/jy/del.jsp";
      })

    }
</script>
</html>
